import request from '@/utils/request'

// 查询【请填写功能名称】列表
export function listStop(query) {
  return request({
    url: 'http://localhost:8011/stop/select/stop/by',
    method: 'get',
    params: query
  })
}

// 获取单车雷西兴
export function getBikeType() {
  return request({
    url: 'http://localhost:8011/biketype/get/all',
    method: 'get'
  })
}

// 新增【请填写功能名称】
export function addStop(data) {
  return request({
    url: 'http://localhost:8011/stop/add/stop',
    method: 'post',
    data:
      JSON.stringify({
        stopno: data.stopno,
        stopname: data.stopname,
        builddate: data.builddate,
        capacity: data.capacity,
        size: 0,
        belong: data.belong,
        geom: JSON.parse(data.geom),
      })
  })
}

// 投放
export function putInStop(data) {
  let src = ''
  for (let item in data) {
    src += encodeURIComponent(item) + '=' + encodeURIComponent(data[item]) + '&'
  }
  return request({
    url: 'http://localhost:8011/stopstore/insert',
    method: 'post',
    data: src,
    headers:{
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
    }
  })
}

